﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace com.dz.ht.ui
{
    public partial class FrmReview : Form
    {
        public FrmReview()
        {
            InitializeComponent();
        }

        private string m_book_name = string.Empty;
        private long m_book_id = 0;
        private bool m_from_db = false;
        private int m_start_book_id;
        private string m_com_list;


        public string BookName
        {
            get { return m_book_name; }
            set { m_book_name = value; }
        }



        public long BookId
        {
            get { return m_book_id; }
            set { m_book_id = value; }
        }

        public bool FromDB
        {
            get { return m_from_db; }
            set { m_from_db = value; }
        }

        public int StartBookId
        {
            get { return m_start_book_id; }
            set { m_start_book_id = value; }
        }

        public string ComList
        {
            get { return m_com_list; }
            set { m_com_list = value; }
        }



        private void btnStart_Click(object sender, EventArgs e)
        {
            m_book_name = txtBookName.Text.Trim();
            if (!long.TryParse(txtBookId.Text.Trim(), out m_book_id))
                m_book_id = 0;

            //if (string.IsNullOrEmpty(m_book_name) || m_book_id == 0)
            //{
            //    MessageBox.Show("提示", "信息不完整!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            FromDB = rdoDb.Checked;
            foreach (System.Windows.Forms.Control control in this.grpCom.Controls)
            {
                if (control is System.Windows.Forms.CheckBox)
                {
                    CheckBox chk = (CheckBox)control;
                    if (chk.Checked)
                    {
                        m_com_list = m_com_list + chk.Text.ToString() + ",";
                    }
                }
            }
            if (string.IsNullOrEmpty(m_com_list))
            {
                MessageBox.Show("提示", "请选择组件!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!int.TryParse(txtStartBookId.Text.Trim(), out m_start_book_id))
                m_start_book_id = 0;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
